<template>
    <div class="search_Data">
        <el-form  :model="form">
            <el-form-item label="">
                <el-radio-group v-model="form.state">
                    <el-radio label="全部" props="0"/>
                    <el-radio label="待就诊" props="1" />
                    <el-radio label="已就诊" props="2" />
                    <el-radio label="已取消" props="3" />
                </el-radio-group>
                <div class="date" style="width:200px">
                    <el-date-picker v-model="form.timer" value-format="YYYY-MM-DD"
                    type="daterange" range-separator="To" start-placeholder="开始日期"
                        end-placeholder="结束日期"  />
                </div>
                <div class="keshi" style="width:120px">
                   <el-select  v-model="form.region" placeholder="请选择科室">
                    <el-option label="呼吸内科" value="呼吸内科" />
                    <el-option label="消化内科" value="消化内科" />
                </el-select> 
                </div>
                <!-- 请选择科室 -->
                <div style="width:230px;margin-right:5px">
                    <el-input  v-model="form.name" placeholder="请输入医生病人姓名" />
                </div>
                <el-button type="primary" @click="onSubmit">搜索</el-button>
            </el-form-item>
        </el-form>
        
    </div>
</template>

<script setup lang="ts">
import { emitChangeFn } from 'element-plus';
import { reactive,ref } from 'vue'
interface Iprops{
  loadData:(currentPage:number,pageSize:number,formdata: Record<string, string>)=> void
  pageSize:number
  currentPage:number
}
const props = defineProps<Iprops>()
// do not use same name with ref
export interface formType{
    "state"?: string
    "timer"?: string
    "region"?: string
    "name"?: string
}

const form = reactive({
    state: '',
    timer: '',
    region: '',
    name: '',
})

const onSubmit=()=>{
    // var formdata=new FormData();
    // for(let key in form){
    //     formdata.append(key,form[key]);
    // }
    console.log(form,props.loadData)
    //???获取不到嘞 获取不到所以走get请求，走不到post请求
    props.loadData(props.currentPage,props.pageSize,form)

}
</script>

<style scoped>
.search_Data {
    width: 100%;
    float:none;
    padding-top: 10px;
}
.keshi{
    margin-left: 175px;
    margin-right: 5px;
}
.date{
    margin-left: 15px;
}
</style>